package service

import (
	"GopherFocus/app/dao"
	"context"
	"github.com/gogf/gf/frame/g"
)

// 持久化Key-Value管理服务
var Setting = settingService{}

type settingService struct{}

// 查询KV,返回泛型,便于转换
func (s *settingService) GetVar(ctx context.Context, key string) (*g.Var, error) {
	v, err := dao.Setting.Ctx(ctx).Fields(dao.Setting.C.V).Where(dao.Setting.C.K, key).Value()
	return v, err
}
